#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFile>
#include <QFileDialog>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QMenuBar* menubar = this->menuBar();
    this->setMenuBar(menubar);
    QMenu* menu = new QMenu("文件");
    menubar->addMenu(menu);
    QAction* action = new QAction("打开");
    menu->addAction(action);
    connect(action, &QAction::triggered, this, &MainWindow::handle);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::handle()
{
    QString str = QFileDialog::getOpenFileName(this);
    QFile file(str);
    QFileInfo fileinfo(file);
    qDebug() << fileinfo.suffix();
    qDebug() << fileinfo.size();
    qDebug() << fileinfo.isDir();
    qDebug() << fileinfo.path();
}

